package com.leetcode.algorithm.y22.m07;

import com.leetcode.algorithm.common.TreeNode;

/**
 * 226. 翻转二叉树
 * 
 * https://leetcode.cn/problems/invert-binary-tree/
 * 
 * @author jie.deng
 *
 */
class Question0226Solution01 {
	
	public TreeNode invertTree(TreeNode root) {
		if (root != null) {
			TreeNode tmp = root.right;
			root.right = root.left;
			root.left = tmp;
			invertTree(root.left);
			invertTree(root.right);
		}
		return root;
	}
    
}